package com.lzl.dao;

import com.lzl.pojo.Dept;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface DeptDao {

    @Insert("insert into dept (dname, db_source) values (#{dname}, DATABASE())")
    boolean addDept(Dept dept);
    // 注意这里的Dept是在另一个项目模块中的, 这里就是Dubbo的时候说的另一种方式了

    @Select("select * from dept where deptno = #{id}")
    Dept queryById(Long id);

    @Select("select * from dept")
    List<Dept> queryAll();
}
